package com.haixee.parkdemo.auth.service.impl;

import com.haixee.parkdemo.auth.dao.AclCustomMapper;
import com.haixee.parkdemo.auth.dao.AclMapper;
import com.haixee.parkdemo.auth.model.Acl;
import com.haixee.parkdemo.auth.service.AclService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class AclServiceImpl implements AclService {

    @Autowired
    private AclMapper aclMapper;

    @Autowired
    private AclCustomMapper aclCustomMapper;

    @Override
    public void addAcl(Integer pid, String name, Boolean isModule, Byte method, String router, Boolean isOpen) {

        Acl acl = new Acl();
        acl.setParentId(pid);
        acl.setName(name);
        acl.setRouter(router);
        acl.setIsOpen(isOpen);
        acl.setIsModule(isModule);
        acl.setMethod(method);

        aclMapper.insertSelective(acl);
    }

    @Override
    public List<Acl> selectAll() {
        return aclCustomMapper.selectAll();
    }
}
